<div class="page">
    <div class="logo"><a href="#"><img src="public/img/logo.png" class="img-responsive" /></a></div>
    <div class="maso" id="maso">
    	<div class="thamgia">
                <input type="text" value="" name="code" id="code">
                <div style="padding:37px 0 0 220px; width:565px;"><a href="javascript:void(0)"><img id="bnt_thamgia" src="public/img/bt-thamgia.png"/></a></div>
        </div>
    </div>

   
    <script type="text/javascript">
        jQuery(document).ready(function(){
            //snow    
            var height = $( window ).height();
            $("#maso").css("height",height-21);
            $.fn.snow();
            
            $("#bnt_thamgia").click(function(){
                if($("#code").val() == "") {
                    $.fancybox( { content: "<p style='color:#fff; width:300px; font-size:20px'>Bạn chưa nhập mã code may mắn!<p>", wrapCSS:'fancybox-custom' } );
                }
                else {
                    $.ajax({
                        url: "<?php echo $site_url;?>checkcode",
                        type: "POST",
                        data: { code: $("#code").val() }
                    }).done(function( result ) {
                        var r = jQuery.parseJSON(result);
                        if(r.success != 'true') {                            
                            $.fancybox( { content: r.err_msg, wrapCSS:'fancybox-custom', afterShow:function(){ test(); } } );      
                        }
                        else
                            window.location.href = r.redirect;
                    }); 
                }                            
            });
        });
        function retype() 
        {
            $.fancybox.close();
            $("#code").val("");
            $("#code").focus();
        }
        function test() 
        {
            $(".fancybox-custom .fancybox-close").css({right:'207px', top:'21px'});
        }
    </script>